home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AppleScript - The Beta Release
/
AppleScript - The Beta Release.iso
/
Goodies
/
AutoGuest
/
PPCAutoGuest.a
< prev
next >
Wrap
Text File
|
1992-12-03
|
3KB
|
137 lines
;;
;; PPC Patch by Paul Young, 8/26/91
;;
;; Some modifications by Greg Anderson, 9/5/91 & 9/17/91
;;
CASE ON
INCLUDE 'Traps.a'
INCLUDE 'PPCToolbox.a'
;;
;; This record is from PPCToolbox.a. I'm not sure why I'm
;; getting assembly errors if I don't include it here; it
;; should be imported by the above 'INCLUDE' line
;;
;; (Greg)
;;
IF &TYPE('StartSecureParams') = 'UNDEFINED' THEN
StartSecureParams RECORD 0; TYPE
prompt DS.L 1; StringPtr
guestSelected DS.L 1; pointer to a Boolean
allowGuest DS.B 1; Boolean
reserved1 DS.B 1; Byte
useDefault DS.B 1; Boolean
reserved2 DS.B 1; Byte
userName DS.L 1; StringPtr
startPb DS.L 1; PPCStartPBPtr
ENDR
ENDIF
noErr EQU 0
noUserInteractionAllowed EQU -610
SEG 'AutoGuest'
PPCAutoGuest PROC EXPORT
EXPORT OldPPCAddress
IMPORT InForeGround
cmp.w #$0E, d0 ; look for _StartSecureSession selector
bne.s @dropThru ; if not, fall through
;; Ok, this is the StartSecureSession trap. We've got a ptr in a0 to the
;; StartSecureParams block, which I've reconstructed above. We want
;; to try a PPCStart as <guest> first.
move.l a0, -(sp) ; hang on to the SSP param block
;; Set ourselves up for the _PPCStart trap by moving just the PPCStartPBPtr
;; into a0.
; add.w #offsetof(StartSecureParams, pb), a0
add.w #StartSecureParams.startPb, a0
move.l (a0), a0
clr.l $3E(a0) ; set the <userRefNum> to <guest>
_PPCStart
; move.w #$02, d0 ; PPCStart selector
; dc.w _PPC ; _PPC Trap
;; Check for an error. If none, we don't need authentication.
cmp.w #$00, d0
bne.s @foregroundcheck
;; We've successfully avoided the authentication box. Set the <guestSelected>
;; field of the SSP param block.
move.l (sp), a0 ; Restore the SSP param block ptr
; add.w #offsetof(StartSecureParams, guestSelected), a0
add.w #StartSecureParams.guestSelected, a0
move.l (a0), a0
move.b #1, (a0)
;; Set the <userName> string to be a 0-char string.
move.l (sp), a0
; add.w #offsetof(StartSecureParams, userName), a0
add.w #StartSecureParams.userName, a0
move.l (a0), a0
move.b #0, (a0) ; set the length byte to 0
;; Return to caller.
move.l (sp)+, a0 ; once again, restore the SSP param block ptr
move.w #noErr, d0 ; GA: set result code to 'noErr'
rts
;; Greg Anderson addition: first check to see if we are in the foreground
@foregroundcheck
jsr InForeGround ; are we in the foreground?
bne.s @authenticate ; yup
;; If we are in the background, return noUserInteractionAllowed <ga>
move.l (sp)+, a0 ; once again, restore the SSP param block ptr
move.w #noUserInteractionAllowed, d0
rts
;; We need to clean up a little and then call StartSecureSession because
;; PPCStart returned an error.
@authenticate
move.l (sp)+, a0 ; restore the SSP param block ptr
move.w #$E, d0 ; restore the SSS selector
@dropThru ; just go ahead and call the PPC dispatch
;; Greg Anderson mod: get rid of global, don't touch a3
BackToPPC
move.l OldPPCAddress, -(sp)
rts
; the actual address will be filled in
; in PatchPPC
OldPPCAddress
dc.l 1
END